home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / New System Software Extensions / QuickDraw™ GX v1.0ß2 / Interfaces & Libraries / interfaces / PrintingDrivers.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-29  |  32.2 KB  |  982 lines  |  [TEXT/MPS ]

  1. /* ------------------------------------------------------------------------------
  2.  
  3.     FILENAME
  4.         PrintingDrivers.h
  5.  
  6.     DESCRIPTION
  7.         This file defines data types and API functions for
  8.         printer driver development.
  9.  
  10.     COPYRIGHT
  11.         Copyright © Apple Computer, Inc. 1989, 1990, 1991, 1992, 1993
  12.         All rights reserved. 
  13.     
  14. ------------------------------------------------------------------------------- */
  15.  
  16. #ifndef __PRINTINGDRIVERS__
  17. #define __PRINTINGDRIVERS__
  18.  
  19.  
  20. #ifndef __PRINTINGMESSAGES__
  21.     #include <PrintingMessages.h>
  22. #endif
  23.  
  24.  
  25. /* ------------------------------------------------------------------------------
  26.  
  27.                         Printing Driver Constants and Types
  28.  
  29. -------------------------------------------------------------------------------- */
  30.  
  31.  
  32. enum {
  33.     gxInputTraysMenuItem = -1            // Menu item number for "Input Trays..."
  34. };
  35.  
  36. enum {                                    // bit fields in communicationsOptions field of IOPrefsRec
  37.     gxUseCustomIO    = 0x00000001            // driver uses a non-standard IO mechanism
  38. };
  39.  
  40. typedef struct {                        // buffering and IO preferences
  41.     unsigned long    communicationsOptions;
  42.     unsigned long    numBuffers;
  43.     unsigned long    bufferSize;
  44.     unsigned long    numReqBlocks;
  45.     unsigned long    openCloseTimeout;
  46.     unsigned long    readWriteTimeout;
  47. } gxIOPrefsRec, *gxIOPrefsPtr, **gxIOPrefsHdl;
  48.  
  49.  
  50. typedef struct {                        // information about writing to a file
  51.     Boolean        printToFile;            // true if output is to go to a file
  52.     FSSpec        fSpec;                    // if going to a file, the FSSpec for the file
  53.     Boolean        includeFonts;            // true if fonts are to be included
  54.     Str31            fileFormat;                // format to write file
  55. } gxPrintDestinationRec, *gxPrintDestinationPtr, **gxPrintDestinationHdl;
  56.  
  57.  
  58. // this structure is the content of each cell in the standard PACK LDEF
  59.  
  60. typedef struct {
  61.     char    firstMarker, secondMarker;        // markers to indicate icon or non-icon version
  62.                                                     // if these are ≈ and ≈, then the cell is an icon cell.
  63.                                                     // Otherwise, it is assumed to be a standard text LDEF
  64.                                                     // cell
  65.     
  66.     Handle    iconSuiteHandle;                // the icon suite to draw for this cell
  67.     Handle    outputDriverName;                // handle to the output driver name (for serial)
  68.     Handle    inputDriverName;                // handle to the input driver name (for serial)
  69.     Str255    iconName;                        // name to draw under the icon
  70. } gxPortListRec, *gxPortListPtr;
  71.  
  72.  
  73. /* ------------------------------------------------------------------------------
  74.  
  75.                         Printing Driver Constants for resources in the desktop printer
  76.  
  77. -------------------------------------------------------------------------------- */
  78.  
  79. // ----------------------------------• 'comm' •----------------------------------
  80.  
  81. // The communications method and private data used to connect to the printer
  82. #define gxDeviceCommunicationsType            'comm'
  83. #define gxDeviceCommunicationsID                (0)
  84.  
  85. // ----------------------------------• 'prod' •----------------------------------
  86.  
  87. // for PostScript devices, the device and version names of the device.
  88. // (0) product name is of type PString
  89. // (1) version is of type PString
  90. // (2) revision is of type PString
  91. // (3) vm available is of type long
  92.  
  93. #define gxPostscriptProductInfoType    'prod'
  94. #define gxPostscriptProductNameID    (0)
  95. #define gxPostscriptVersionID            (1)
  96. #define gxPostscriptRevisionID        (2)
  97. #define gxPostscriptVMAvailableID    (3)
  98.  
  99.  
  100. /* ------------------------------------------------------------------------------
  101.  
  102.                         Printing Driver Constants for status alerts
  103.  
  104. -------------------------------------------------------------------------------- */
  105.  
  106. // the ditl id for the auto feed button in the manual feed alert
  107.  
  108. enum {                                    
  109.     gxAutoFeedButtonId    = 3
  110. };
  111.  
  112.  
  113. // status resource id for the alerts
  114.  
  115. enum {                                    
  116.     gxUnivAlertStatusResourceId    = -28508
  117. };
  118.  
  119.  
  120. // status resource indices for the alerts
  121.  
  122. enum {
  123.     gxUnivManualFeedIndex         = 2,
  124.     gxUnivFailToPrintIndex     = 3,
  125.     gxUnivPaperJamIndex         = 4,
  126.     gxUnivOutOfPaperIndex         = 5,
  127.     gxUnivNoPaperTrayIndex     = 6,
  128.     gxUnivPrinterReadyIndex     = 7,
  129.     gxUnivAlertBeforeIndex     = 9,
  130.     gxUnivAlertAfterIndex         = 10
  131. };
  132.  
  133. // allocation sizes for status buffers needed for automatic alerts
  134.  
  135.  
  136. enum {                                    
  137.     gxDefaultStatusBufferSize        = 10,
  138.     gxManualFeedStatusBufferSize = 34,
  139.     gxOutOfPaperStatusBufferSize = 42
  140. };
  141.  
  142.  
  143. // structures for status buffers
  144.  
  145. typedef struct {                            // structure passed in statusBuffer of StatusRecord for manual feed alert
  146.     Boolean    canAutoFeed;                // true if driver can switch to auto feed
  147.     Str31        paperTypeName;                // name of paperType to feed manually
  148. } gxManualFeedRecord;
  149.  
  150.  
  151. typedef struct {                            // structure passed in statusBuffer of StatusRecord for out of paper alert
  152.     Str31        paperTypeName;                // name of printing document
  153. } gxOutOfPaperRecord;
  154.  
  155.  
  156. /* ------------------------------------------------------------------------------
  157.  
  158.                                 Old Application Support
  159.  
  160. -------------------------------------------------------------------------------- */
  161.  
  162.  
  163. // the format of a 'cust' resource 
  164.  
  165. typedef struct {
  166.     short horizontalResolution;
  167.     short    verticalResolution;
  168.     short upDriverType;
  169.     Point patternStretch;
  170.     short    translatorSettings;
  171. } gxCustomizationRec, *gxCustomizationPtr, **gxCustomizationHdl;
  172.     
  173.  
  174. // the format of a 'resl' resource
  175.  
  176. typedef struct {
  177.     short        rangeType;                // always 1
  178.     short        xMinimumResolution;
  179.     short        xMaximumResolution;
  180.     short        yMinimumResolution;
  181.     short        yMaximumResolution;
  182.     short        resolutionCount;
  183.     Point        resolutions[1];
  184. } gxResolutionRec, *gxResolutionPtr, **gxResolutionHdl;
  185.  
  186.  
  187. // constants for the "universal" print record...    
  188.  
  189.  
  190. enum {                                    // version number for "universal" print record
  191.     gxPrintRecordVersion    = 8
  192. };
  193.  
  194. enum {                                    // for calculationMode field...
  195.     gxEmulation                = 0,
  196.     gxTheoretical            = 1
  197. };
  198.  
  199. enum {                                    // for feed field...
  200.     gxAutoFeed                    = 0,
  201.     gxManualFeed                = 1
  202. };
  203.  
  204. enum {                                    // bit fields for options field...
  205.     gxPreciseBitmap            = 0x0001,    // tall adjusted (IW), precise bitmap (LW, SC)
  206.     gxBiggerPages                = 0x0002,    // no gaps (IW), larger print area (LW)
  207.     gxGraphicSmoothing        = 0x0004,    // graphic smoothing (LW)
  208.     gxTextSmoothing            = 0x0008,    // text smoothing (SC)
  209.     gxFontSubstitution        = 0x0010,    // font substitution
  210.     gxInvertPage                = 0x0020,    // b/w invert image
  211.     gxFlipPageHoriz            = 0x0040,    // flip horizontal
  212.     gxFlipPageVert                = 0x0080,    // flip vertical
  213.     gxColorMode                    = 0x0100,    // color printing
  214.     gxBidirectional            = 0x0200,    // bidirectional printing
  215.     gxUserFlag0                    = 0x0400,    // user flag 0
  216.     gxUserFlag1                    = 0x0800,    // user flag 1
  217.     gxUserFlag2                    = 0x1000,    // user flag 2
  218.     gxReservedFlag0            = 0x2000,    // reserved flag 0
  219.     gxReservedFlag1            = 0x4000,    // reserved flag 1
  220.     gxReservedFlag2            = 0x8000        // reserved flag 2
  221. };
  222.  
  223. enum {                                    // for orientation field...
  224.     gxPortraitOrientation        = 0,
  225.     gxLandscapeOrientation        = 1,
  226.     gxAltPortraitOrientation    = 2,
  227.     gxAltLandscapeOrientation    = 3
  228. };
  229.  
  230. enum {                                    // for qualityMode field...
  231.     gxBestQuality            = 0,
  232.     gxFasterQuality        = 1,
  233.     gxDraftQuality            = 2
  234. };
  235.  
  236. enum {                                    // for firstTray and remainingTray fields...
  237.     gxFirstTray                = 0,
  238.     gxSecondTray            = 1,
  239.     gxThirdTray                = 2
  240. };
  241.  
  242. enum {                                    // for coverPage field...
  243.     gxNoCoverPage                = 0,
  244.     gxFirstPageCover            = 1,
  245.     gxLastPageCover            = 2
  246. };
  247.  
  248. enum {                                    // for headMotion field...
  249.     gxUnidirectionalMotion    = 0,
  250.     gxBidirectionalMotion    = 1
  251. };
  252.  
  253. enum {                                    // for saveFile field...
  254.     gxNoFile                    = 0,
  255.     gxPostScriptFile            = 1
  256. };
  257.  
  258.  
  259. // the format of the "universal" print record
  260.  
  261. typedef struct {
  262.     short                prVersion;          // print record version 
  263.     
  264.                                                     // prInfo subrecord...
  265.     
  266.     short                appDev;                    // device kind, always 0
  267.     short                appVRes;                    // application vertical resolution
  268.     short                appHRes;                    // application horizontal resolution
  269.     Rect                appPage;                    // page size, in application resolution
  270.     
  271.     Rect                 appPaper;                // paper rectangle [offset from rPage]
  272.     
  273.                                                 // prStl subrecord...
  274.                                         
  275.     short                devType;                    // device type, always 0xA900 (was wDev)
  276.     short                pageV;                    // page height in 120ths of an inch
  277.     short                pageH;                    // page width in 120ths of an inch
  278.     char                fillByte;                // page calculation mode
  279.     char                feed;                        // feed mode
  280.     
  281.                                                 // prInfoPT subrecord...
  282.                                         
  283.     short                devKind;                    // device kind, always 0
  284.     short                devVRes;                    // device vertical resolution
  285.     short                devHRes;                    // device horizontal resolution
  286.     Rect                devPage;                    // device page size
  287.     
  288.                                                 // prXInfo subrecord...
  289.                                         
  290.     short                actualCopies;            // actual number of copies for this job
  291.     short                options;                    // options for this device
  292.     short                reduction;                // reduce/enlarge factor
  293.     
  294.     char                orientation;            // orientation of paper ( 0=portrait, 1=landscape )
  295.     
  296.                                                 // clusters...
  297.                                         
  298.     char                qualityMode;            // quality mode
  299.     char                firstTray;                // first feed tray
  300.     char                remainingTray;            // remaining feed tray
  301.     char                coverPage;                // cover page
  302.     char                headMotion;                // head motion
  303.     char                saveFile;                // save file
  304.     
  305.     char                userCluster1;        // three clusters left over...
  306.     char                userCluster2;
  307.     char                userCluster3;
  308.  
  309.                                                 // prJob subrecord...
  310.                                     
  311.     short                firstPage;                // first page
  312.     short                lastPage;                // last page
  313.     short                copies;                    // # of copies, always 1
  314.     char                reserved1;                // always true, unused
  315.     char                reserved2;                // always true, unused
  316.     PrIdleProcPtr    pIdleProc;                // idle proc
  317.     Ptr                pFileName;                // spool file name pointer
  318.     short                fileVol;                    // spool file vRefNum
  319.     char                fileVers;                // file version, must be 0
  320.     char                reserved3;                // always 0
  321.     
  322.     short             printX[19];          // internal use
  323. } gxUniversalPrintRecord, *gxUniversalPrintRecordPtr, **gxUniversalPrintRecordHdl;
  324.         
  325.  
  326.  
  327. /* ------------------------------------------------------------------------------
  328.  
  329.                             Compatibility Printing Messages
  330.  
  331. -------------------------------------------------------------------------------- */
  332.  
  333.  
  334. #ifdef __cplusplus
  335. extern "C" {
  336. #endif
  337.  
  338.  
  339. OSErr Forward_GXPrOpenDoc (THPrint, TPPrPort *)
  340.     = GXFORWARDGLUE;
  341.  
  342. OSErr Forward_GXPrCloseDoc (TPPrPort)
  343.     = GXFORWARDGLUE;
  344.  
  345. OSErr Forward_GXPrOpenPage (TPPrPort, TPRect, Point resolution)
  346.     = GXFORWARDGLUE;
  347.  
  348. OSErr Forward_GXPrClosePage (TPPrPort)
  349.     = GXFORWARDGLUE;
  350.  
  351. OSErr Forward_GXPrintDefault (THPrint)
  352.     = GXFORWARDGLUE;
  353.  
  354. OSErr Forward_GXPrStlDialog (THPrint, Boolean *)
  355.     = GXFORWARDGLUE;
  356.  
  357. OSErr Forward_GXPrJobDialog (THPrint, Boolean *)
  358.     = GXFORWARDGLUE;
  359.  
  360. OSErr Forward_GXPrStlInit (THPrint, TPPrDlg *)
  361.     = GXFORWARDGLUE;
  362.  
  363. OSErr Forward_GXPrJobInit (THPrint, TPPrDlg *)
  364.     = GXFORWARDGLUE;
  365.  
  366. OSErr Forward_GXPrDlgMain (THPrint, PDlgInitProcPtr, Boolean *)
  367.     = GXFORWARDGLUE;
  368.  
  369. OSErr Forward_GXPrValidate (THPrint, Boolean *)
  370.     = GXFORWARDGLUE;
  371.  
  372. OSErr Forward_GXPrJobMerge (THPrint, THPrint)
  373.     = GXFORWARDGLUE;
  374.  
  375. OSErr Forward_GXPrGeneral (Ptr)
  376.     = GXFORWARDGLUE;
  377.  
  378. OSErr Forward_GXConvertPrintRecordTo (THPrint)
  379.     = GXFORWARDGLUE;
  380.  
  381. OSErr Forward_GXConvertPrintRecordFrom (THPrint)
  382.     = GXFORWARDGLUE;
  383.  
  384. OSErr Forward_GXPrintRecordToJob (THPrint, gxJob)
  385.     = GXFORWARDGLUE;
  386.  
  387.  
  388. #ifdef __cplusplus
  389. }
  390. #endif
  391.  
  392.  
  393.  
  394. /* ------------------------------------------------------------------------------
  395.  
  396.                         Raster Driver Contants and Types
  397.  
  398. -------------------------------------------------------------------------------- */
  399.  
  400.  
  401.  
  402. typedef long gxRasterPlaneOptions;
  403.  
  404. enum {                                        // bit fields in RasterPlaneOptions
  405.     gxDefaultOffscreen         = 0x00000000,    // default value - bits are allocated for the client, halftoning takes place
  406.     gxDontSetHalftone            = 0x00000001,    // don't call SetViewPortHalftone
  407.     gxDotTypeIsDitherLevel    = 0x00000002    // call SetViewPortDither using the dotType as the level
  408. };
  409.  
  410. typedef struct {                            // input structure for setting up the offscreen
  411.     gxRasterPlaneOptions        planeOptions;    // options for the offscreen package
  412.     gxHalftone                    planeHalftone;    // OPTIONAL: halftone structure for this plane
  413.     gxColorSpace                planeSpace;        // OPTIONAL: noSpace will get the graphics default
  414.     gxColorSet                    planeSet;        // OPTIONAL: NIL gets the default
  415.     gxColorProfile                planeProfile;    // OPTIONAL: NIL gets no matching
  416. } gxPlaneSetupRec;
  417.     
  418. typedef struct {
  419.     short                 width;                 // Width in pixels
  420.     short                 minHeight;             // minimum height in pixels - actual height returned here
  421.     short                    maxHeight;            // maximum height in pixels
  422.     fixed                    ramPercentage;        // maximum percentage of RAM to take
  423.     long                    ramSlop;                // amount of RAM to be sure to leave
  424.     short                 depth;                 // Depths in bits of each plane
  425.     gxMapping            vpMapping;            // mapping to assign to offscreen viewPorts
  426.     gxMapping            vdMapping;            // mapping to assign to offscreen viewDevices
  427.     short                 planes;                // # of planes to allocate of depth bits each (can be more than 4)
  428.     gxPlaneSetupRec    planeSetup[4];        // parameters for each plane, 4 is provided because it is most handy for writers of devices
  429. } gxOffscreenSetupRec;
  430.  
  431.  
  432.  
  433. typedef struct {                            // the format of one plane in the offscreen planar area
  434.     gxViewPort            theViewPort;            // viewPort for the offscreen
  435.     gxViewDevice        theDevice;                // viewDevice for the offscreen
  436.     gxViewGroup            theViewGroup;            // the viewGroup that they share
  437.     gxShape                theBitmap;                // the offscreen bitmap shape
  438.     gxBitmap                theBits;                    // the bits of the offscreen
  439. } gxOffscreenPlaneRec;
  440.  
  441. typedef struct {                            // an entire offscreen area
  442.     short                        numberOfPlanes;    // number of planes we have
  443.     Handle                    offscreenStorage;    // handle containing the bitmaps image data
  444.     gxOffscreenPlaneRec    thePlanes[1];        // planes to draw in
  445. } gxOffscreenRec, *gxOffscreenPtr, **gxOffscreenHdl;
  446.  
  447.  
  448.  
  449. typedef long gxRasterRenderOptions;
  450.  
  451. enum {                                        // bit fields in RasterRenderOptions
  452.     gxDefaultRaster                = 0x00000000,    // default raster options
  453.     gxDontResolveTransferModes = 0x00000001,    // 0=Resolve, 1=Don't Resolve
  454.     gxRenderInReverse                 = 0x00000002,    // traverse image in reverse order
  455.     gxOnePlaneAtATime                = 0x00000004,    // render each plane separately
  456.     gxSendAllBands                    = 0x00000008    // send even empty bands
  457. };
  458.  
  459.  
  460. typedef struct {                            // structure of resource to control raster imaging
  461.     gxRasterRenderOptions    renderOptions;    // options for the raster imaging system
  462.     fixed                            hImageRes;        // horizontal resolution to image at
  463.     fixed                            vImageRes;        // vertical resolution to image at
  464.     short                            minBandSize;    // minimum band size to use (in pixels)
  465.     short                            maxBandSize;    // maximum band size to use (in pixels), 0 == entire page
  466.     fixed                            ramPercentage;    // maximum percentage of RAM to take
  467.     long                            ramSlop;            // amount of RAM to be sure to leave
  468.     short                            depth;            // depth in pixels (PER PLANE!)
  469.     short                            numPlanes;        // number of planes to render
  470.     gxPlaneSetupRec            planeSetup[1];    // one for each plane
  471. } gxRasterPrefsRec, *gxRasterPrefsPtr, **gxRasterPrefsHdl;
  472.  
  473.  
  474. typedef long gxRasterPackageOptions;
  475.  
  476. enum {                                        // bit fields in RasterPackageOptions
  477.     gxSendAllColors    = 0x00000001,                                // send even clean bands through
  478.     gxInterlaceColor    = 0x00000002,                                // ribbon contamination is a concern
  479.     gxOverlayColor        = 0x00000004,                                // color printer without a ribbon problem
  480.     gxUseColor            =    (gxInterlaceColor|gxOverlayColor)        // this is a color printer
  481. };
  482.  
  483.  
  484. typedef struct {                            // resource to control the RasterDataIn message
  485.     Ptr                            bufferSize;            // buffer size for packaging (>= maximum head pass size)
  486.     short                            colorPasses;        // 1 (b/w) or 4 (CMYK) is typical
  487.     short                         headHeight;            // printhead height in pixels
  488.     short                         numberPasses;        // number of head passes it takes to == iHeadHeight
  489.     short                            passOffset;            // offset between passes, in pixels
  490.     gxRasterPackageOptions    packageOptions;    // packaging options
  491. } gxRasterPackageRec, *gxRasterPackagePtr, **gxRasterPackageHdl;
  492.  
  493.  
  494. typedef struct {                                            // for RasterPackageBitmap message
  495.     gxBitmap                            *bitmapToPackage;        // bitmap containing the data to package
  496.     unsigned short                    startRaster;            // raster to begin the packaging from
  497.     unsigned short                    colorBand;                // for which color pass this is a packaging request
  498.     Boolean                            isBandDirty;            // whether there are any dirty bits in this band
  499.     Rect                                dirtyRect;                // which bits are dirty
  500. } gxRasterPackageBitmapRec;
  501.  
  502.  
  503. typedef struct    {                            // for outputing numbers
  504.     short    numberType;                            // type of numberic output desired
  505.     short minWidth;                            // minimum output width of the number
  506.     char    padChar;                                // pad character for numbers shorter than the minWidth
  507.     char    alignment;                            // whee!
  508.     Str31    startString;                        // prefix string
  509.     Str31    endString;                            // postfix string
  510. } gxStandardNumberRec, *gxStandardNumberPtr;
  511.  
  512.  
  513.  
  514. typedef struct {                            // structure of resource to control other messages
  515.     short                        startPageStringID;    // 'wstr' to send to the device at start of page
  516.     short                        formFeedStringID;        // 'wstr' to send to the device to cause a form feed
  517.     short                        forwardMax;                // line feed strings
  518.     gxStandardNumberRec    forwardLineFeed;
  519.     short                        reverseMax;
  520.     gxStandardNumberRec    reverseLineFeed;
  521. } gxRasterPackageControlsRec, *gxRasterPackageControlsPtr, **gxRasterPackageControlsHdl;
  522.  
  523.  
  524.  
  525. typedef struct {                            // raster imaging system imageData structure
  526.  
  527.     // setup values
  528.  
  529.     gxRasterRenderOptions        renderOptions;        // options for the raster imaging system
  530.     fixed                                hImageRes;            // horizontal resolution to image at
  531.     fixed                                vImageRes;            // vertical resolution to image at
  532.     short                                minBandSize;        // smallest band that makes sense for this device
  533.     short                                maxBandSize;        // biggest band that makes sense, or 0 for "full page"
  534.     gxRectangle                        pageSize;            // size of page for device
  535.     
  536.     // values used within the RasterDataIn message
  537.     
  538.     short                                currentYPos;        // current position moving down the page
  539.     gxRasterPackageRec            packagingInfo;        // raster packaging record
  540.     
  541.     // values used within the remaining messages
  542.     
  543.     Boolean                            optionsValid;        // were options specified by the driver?
  544.     gxRasterPackageControlsRec    packageControls;    // options for the packaging messages
  545.  
  546.     gxOffscreenSetupRec                theSetup;            // setup for the offscreen code, variable length componant
  547. } gxRasterImageDataRec, *gxRasterImageDataPtr, **gxRasterImageDataHdl;
  548.  
  549.  
  550.  
  551. /* ------------------------------------------------------------------------------
  552.  
  553.                                 Raster Driver Imaging Messages
  554.  
  555. -------------------------------------------------------------------------------- */
  556.  
  557.  
  558. #ifdef __cplusplus
  559. extern "C" {
  560. #endif
  561.  
  562.  
  563. #define GXRASTERMSGGLUE(selector) SendMessageGlue(0x0001, selector)
  564. #define GXFORWARDGLUE ForwardThisMessageGlue
  565.  
  566.  
  567. OSErr Send_GXRasterDataIn (gxOffscreenHdl, gxRectangle *bandRectangle, gxRectangle *dirtyRectangle)
  568.     = GXRASTERMSGGLUE(gxRasterDataIn);
  569. OSErr Forward_GXRasterDataIn (gxOffscreenHdl, gxRectangle *bandRectangle, gxRectangle *dirtyRectangle)
  570.     = GXFORWARDGLUE;
  571.          
  572. OSErr Send_GXRasterLineFeed (short *lineFeedSize, Ptr buffer, unsigned long *bufferPos, gxRasterImageDataHdl)
  573.     = GXRASTERMSGGLUE(gxRasterLineFeed);
  574. OSErr Forward_GXRasterLineFeed (short *lineFeedSize, Ptr buffer, unsigned long *bufferPos, gxRasterImageDataHdl)
  575.     = GXFORWARDGLUE;
  576.     
  577. OSErr Send_GXRasterPackageBitmap (gxRasterPackageBitmapRec *whatToPackage, Ptr buffer,
  578.                                           unsigned long *bufferPos, gxRasterImageDataHdl)
  579.     = GXRASTERMSGGLUE(gxRasterPackageBitmap);
  580. OSErr Forward_GXRasterPackageBitmap (gxRasterPackageBitmapRec *whatToPackage, Ptr buffer,
  581.                                                 unsigned long *bufferPos, gxRasterImageDataHdl)
  582.     = GXFORWARDGLUE;
  583.  
  584.  
  585. #ifdef __cplusplus
  586. }
  587. #endif
  588.  
  589.  
  590.  
  591. /* ------------------------------------------------------------------------------
  592.  
  593.                         Vector Driver Contants and Types
  594.  
  595. -------------------------------------------------------------------------------- */
  596.  
  597.  
  598.  
  599. typedef long gxVectorRenderOptions;
  600.  
  601. enum {                                // bit fields in VectorRenderOptions
  602.     gxColorSort            = 0x00000001,    // set for pen plotters. 
  603.     gxATransferMode    = 0x00000002,    // set if transfer modes need to be resolved 
  604.     gxNoOverlap            = 0x00000004,    // set if non-overlapping output is desired
  605.     gxAColorBitmap        = 0x00000008,    // set if color bitmap output is desired
  606.     gxSortbyPenPos        = 0x00000010,    // set if shapes are to be drawn in the order of the pen index
  607.                                                  // in the pen table. NOTE: this is not the pen position in the carousel.
  608.     gxPenLessPlotter    = 0x00000020,    // indicates raster printer/plotter
  609.     gxCutterPlotter    = 0x00000040,    // indicates cutter
  610.     gxNoBackGround        = 0x00000080    // set if shapes that map to the background color should not be sent to driver 
  611. };
  612.  
  613.             
  614. typedef long gxVectorShapeOptions;
  615.  
  616. enum {                                        // bit fields in gxVectorShapeOptions
  617.     gxUnidirectionalFill            = 0x00000001,    // generate scanlines in one direction only.. useful for transparencies
  618.     gxAlsoOutlineFilledShape    = 0x00000002    // turn on this bit to also outline solid filled shapes 
  619. };
  620.  
  621.  
  622. typedef struct {
  623.     fixed        angle;                // angle to halftone at. Must be 0, 90, 45 or 135
  624.     long        penIndex;            // index of the pen to draw this component with
  625. } gxVHalftoneCompRec;
  626.   
  627.   
  628. typedef struct {
  629.     gxColorSpace            halftoneSpace;
  630.     gxVHalftoneCompRec    halftoneComps[4]; // info for each color component
  631.     long                        penIndexForBW;     // pen index to draw one bit deep or black and white bitmap with
  632. } gxVHalftoneRec;
  633.  
  634.  
  635. typedef struct {
  636.     gxVectorShapeOptions    shapeOptions;      // options to control shape handling
  637.     long                        maxPolyPoints;     // maximum number of polygon points that device can support
  638.     fixed                        shapeError;        // defines allowed deviation from the original shape
  639.     fixed                        textSize;           // text above this size is filled; text below this size is outlined
  640.     fixed                        frameSize;            // frame's smaller than this -> shape stroked; frame's larger -> shape is filled
  641. } gxVectorShapeDataRec;
  642.  
  643.  
  644. typedef struct {                                // vector imaging system imageData structure
  645.     gxVectorRenderOptions    renderOptions;        // options to control rendering: color sort, clipping, etc.
  646.     fixed                            devRes;                // device resolution
  647.     gxTransform                devTransform;        // mapping, clip and halftoning information for colored bitmaps
  648.     gxColorSet                    clrSet;                // entire set of colors; usually indexed color space for pen plotters
  649.     gxColor                       bgColor;                // the background color in the color space specified by the clrSpace field
  650.     gxVHalftoneRec                halftoneInfo;        // defines halftone information for color bitmaps
  651.     gxPenTableHdl                hPenTable;            // complete list of pens along with their pen positions and thickness
  652.     gxRectangle                    pageRect;            // page dimensions
  653.     gxVectorShapeDataRec        shapeData;            // information on how to render a shape
  654. } gxVectorImageDataRec, *gxVectorImageDataPtr, **gxVectorImageDataHdl;
  655.  
  656.  
  657.  
  658. /* ------------------------------------------------------------------------------
  659.  
  660.                                 Vector Driver Imaging Messages
  661.  
  662. -------------------------------------------------------------------------------- */
  663.  
  664.  
  665. #ifdef __cplusplus
  666. extern "C" {
  667. #endif
  668.  
  669.  
  670. #define GXVECTORMSGGLUE(selector) SendMessageGlue(0x0001, selector)
  671. #define GXFORWARDGLUE ForwardThisMessageGlue
  672.  
  673.  
  674. OSErr Send_GXVectorPackageShape (gxShape, long penIndex)
  675.     = GXVECTORMSGGLUE(gxVectorPackageData);
  676. OSErr Forward_GXVectorPackageShape (gxShape, long penIndex)
  677.     = GXFORWARDGLUE;
  678.     
  679. OSErr Send_GXVectorLoadPens (gxPenTableHdl, long *shapeCounts, boolean *penTableChanged)
  680.     = GXVECTORMSGGLUE(gxVectorLoadPens);
  681. OSErr Forward_GXVectorLoadPens (gxPenTableHdl, long *shapeCounts, boolean *penTableChanged)
  682.     = GXFORWARDGLUE;
  683.  
  684. OSErr Send_GXVectorVectorizeShape (gxShape, long penIndex, gxVectorShapeDataRec *)
  685.     = GXVECTORMSGGLUE(gxVectorVectorizeShape);
  686. OSErr Forward_GXVectorVectorizeShape (gxShape, long penIndex, gxVectorShapeDataRec *)
  687.     = GXFORWARDGLUE;
  688.  
  689.  
  690. #ifdef __cplusplus
  691. }
  692. #endif
  693.  
  694.  
  695.  
  696. /* ------------------------------------------------------------------------------
  697.  
  698.                             PostScript Driver Contants and Types
  699.  
  700. -------------------------------------------------------------------------------- */
  701.  
  702.  
  703.  
  704. enum { gxPostSynonym = (long)'post' };
  705.  
  706.  
  707. typedef long gxPostScriptRenderOptions;
  708.  
  709. enum {                                             // bit fields in PostScriptRenderOptions
  710.     gxNeedsHexOption                = 0x00000001,    // convert all binary data to hex
  711.     gxNeedsCommentsOption        = 0x00000002,    // issue PostScript comments
  712.     gxBoundingBoxesOption        = 0x00000004,    // calculate the values for %%BoundingBox: and %%PageBoundingBox: -- requires needsCommentsOption
  713.     gxPortablePostScriptOption    = 0x00000008,    // generate portable PostScript
  714.     gxTextClipsToPathOption        = 0x00000010,    // convert all clips that are composed of text to path shapes
  715.     gxFlattenClipPathOption        = 0x00000020,    // convert all clips that are path shapes to polygons (helps better control point limit)
  716.     gxUseCharpath1Option            = 0x00000040,    // (ignored if text clips are converted to paths)  When the clip is text, 
  717.                                                             // do it one glyph at a time, redrawing the main shape each time
  718.     gxUseLevel2ColorOption        = 0x00000080    // When printing to level-2 use level-2 device independent color
  719. };
  720.  
  721.  
  722.  
  723. typedef struct {
  724.  
  725.     gxFont                    theFont;                            // ---> font reference.
  726.     long                        nGlyphs;                            // ---> Number of glyphs in the font.
  727.  
  728.     gxFontPlatform            platform;                        // <--- How printer font is encoded.
  729.     gxFontScript            script;                            // <--- Script if platform != glyphPlatform
  730.     gxFontLanguage            language;                        // <--- Language if platform != glyphPlatform.
  731.     
  732.     long                        vmUsage;                            // <--- how much PostScript VM font uses.
  733.  
  734.     /** size of this is longAlligned(nGlyphs) **/
  735.     unsigned long        glyphBits[1];                        // <--- Bit array of which system glyphs are in printer.
  736.  
  737. } gxPrinterGlyphsRec;
  738.  
  739. typedef struct {                                // PostScript imaging system imageData structure
  740.     short                                languageLevel;    // PostScript language level
  741.     gxColorSpace                    devCSpace;        // the printer's color space
  742.     gxColorProfile                    devCProfile;    // The printer's color profile for matching
  743.     gxPostScriptRenderOptions    renderOptions;    // options for the imaging system
  744.     short                                pathLimit;        // maximum path size
  745.     short                                gsaveLimit;        // maximum number of gsaves allowed
  746.     short                                opStackLimit;    // operand stack limit
  747.     scalerStreamTypeFlag            fontType;        // these are the font types that the printer supports 
  748.     long                                printerVM;        // how much memory is in the printer
  749.     long                                reserved0;
  750. } gxPostScriptImageDataRec, *gxPostScriptImageDataPtr, **gxPostScriptImageDataHdl;
  751.  
  752.  
  753. typedef struct    {                                // for GetProcSetList / DownLoadProcSetList messages
  754.     Signature    clientid;
  755.     OSType        controlType;                        // the driver will call FetchTaggedData on each of these resources
  756.     short            controlid;
  757.     OSType        dataType;
  758.     long            reserved0;
  759. } gxProcSetListRec, *gxProcSetListPtr, **gxProcSetListHdl;
  760.  
  761.  
  762.  
  763.  
  764. enum {                             // possible results of querying printer (returned by PostScriptQueryPrinter message)
  765.     gxPrinterOK                = 0,
  766.     gxIntializePrinter    = 1, 
  767.     gxFilePrinting            = 2,
  768.     gxResetPrinter         = 128
  769. };
  770.  
  771.  
  772.  
  773. /* ------------------------------------------------------------------------------
  774.  
  775.                                 PostScript Driver Imaging Messages
  776.  
  777. -------------------------------------------------------------------------------- */
  778.  
  779.  
  780. #ifdef __cplusplus
  781. extern "C" {
  782. #endif
  783.  
  784.  
  785. #define GXPOSTSCRIPTMSGGLUE(selector) SendMessageGlue(0x0001, selector)
  786. #define GXFORWARDGLUE ForwardThisMessageGlue
  787.  
  788.  
  789. // device control messages
  790.  
  791.  
  792. OSErr Send_GXPostScriptQueryPrinter (long *)
  793.     = GXPOSTSCRIPTMSGGLUE(gxPostscriptQueryPrinter);
  794. OSErr Forward_GXPostScriptQueryPrinter (long *)
  795.     = GXFORWARDGLUE;
  796.  
  797. OSErr Send_GXPostScriptInitializePrinter (void)
  798.     = GXPOSTSCRIPTMSGGLUE(gxPostscriptInitializePrinter);
  799. OSErr Forward_GXPostScriptInitializePrinter (void)
  800.     = GXFORWARDGLUE;
  801.  
  802. OSErr Send_GXPostScriptResetPrinter (void)
  803.     = GXPOSTSCRIPTMSGGLUE(gxPostscriptResetPrinter);
  804. OSErr Forward_GXPostScriptResetPrinter (void)
  805.     = GXFORWARDGLUE;
  806.  
  807. OSErr Send_GXPostScriptExitServer (void)
  808.     = GXPOSTSCRIPTMSGGLUE(gxPostscriptExitServer);
  809. OSErr Forward_GXPostScriptExitServer (void)
  810.     = GXFORWARDGLUE;
  811.     
  812.     
  813. // device communication messages
  814.  
  815.  
  816. OSErr Send_GXPostScriptGetStatusText (Handle)
  817.     = GXPOSTSCRIPTMSGGLUE(gxPostscriptGetStatusText);
  818. OSErr Forward_GXPostScriptGetStatusText (Handle)
  819.     = GXFORWARDGLUE;
  820.  
  821. OSErr Send_GXPostScriptGetPrinterText (Handle)
  822.     = GXPOSTSCRIPTMSGGLUE(gxPostscriptGetPrinterText);
  823. OSErr Forward_GXPostScriptGetPrinterText (Handle)
  824.     = GXFORWARDGLUE;
  825.  
  826. OSErr Send_GXPostScriptScanStatusText (Handle)
  827.     = GXPOSTSCRIPTMSGGLUE(gxPostscriptScanStatusText);
  828. OSErr Forward_GXPostScriptScanStatusText (Handle)
  829.     = GXFORWARDGLUE;
  830.  
  831. OSErr Send_GXPostScriptScanPrinterText (Handle)
  832.     = GXPOSTSCRIPTMSGGLUE(gxPostscriptScanPrinterText);
  833. OSErr Forward_GXPostScriptScanPrinterText (Handle)
  834.     = GXFORWARDGLUE;
  835.  
  836.  
  837. // proc set management messages
  838.  
  839.  
  840. OSErr Send_GXPostScriptGetDocumentProcSetList (gxProcSetListHdl, gxPostScriptImageDataHdl)
  841.     = GXPOSTSCRIPTMSGGLUE(gxPostscriptGetDocumentProcSetList);
  842. OSErr Forward_GXPostScriptGetDocumentProcSetList (gxProcSetListHdl, gxPostScriptImageDataHdl)
  843.     = GXFORWARDGLUE;
  844.  
  845. OSErr Send_GXPostScriptDownloadProcSetList (gxProcSetListHdl, gxPostScriptImageDataHdl)
  846.     = GXPOSTSCRIPTMSGGLUE(gxPostscriptDownloadProcSetList);
  847. OSErr Forward_GXPostScriptDownloadProcSetList (gxProcSetListHdl, gxPostScriptImageDataHdl)
  848.     = GXFORWARDGLUE;
  849.     
  850.     
  851. // font management messages
  852.  
  853.  
  854. OSErr Send_GXPostScriptGetPrinterGlyphsInformation (gxPrinterGlyphsRec *)
  855.     = GXPOSTSCRIPTMSGGLUE(gxPostscriptGetPrinterGlyphsInformation);
  856. OSErr Forward_GXPostScriptGetPrinterGlyphsInformation (gxPrinterGlyphsRec *)
  857.     = GXFORWARDGLUE;
  858.  
  859. OSErr Send_GXPostScriptStreamFont (gxFont fontref, scalerStream* streamPtr)
  860.     = GXPOSTSCRIPTMSGGLUE(gxPostscriptStreamFont);
  861. OSErr Forward_GXPostScriptPostScriptStreamFont (gxFont fontref, scalerStream* streamPtr)
  862.     = GXFORWARDGLUE;
  863.  
  864.  
  865. // document structuring and formatting messages
  866.  
  867.  
  868. OSErr Send_GXPostScriptDoDocumentHeader (gxPostScriptImageDataHdl)
  869.     = GXPOSTSCRIPTMSGGLUE(gxPostscriptDoDocumentHeader);
  870. OSErr Forward_GXPostScriptDoDocumentHeader (gxPostScriptImageDataHdl)
  871.     = GXFORWARDGLUE;
  872.     
  873. OSErr Send_GXPostScriptDoDocumentSetup (gxPostScriptImageDataHdl)
  874.     = GXPOSTSCRIPTMSGGLUE(gxPostscriptDoDocumentSetUp);
  875. OSErr Forward_GXPostScriptDoDocumentSetup (xgPostScriptImageDataHdl)
  876.     = GXFORWARDGLUE;
  877.  
  878. OSErr Send_GXPostScriptDoDocumentTrailer (gxPostScriptImageDataHdl)
  879.     = GXPOSTSCRIPTMSGGLUE(gxPostscriptDoDocumentTrailer);
  880. OSErr Forward_GXPostScriptDoDocumentTrailer (gxPostScriptImageDataHdl)
  881.     = GXFORWARDGLUE;
  882.     
  883.     
  884. // page structuring and formatting messages
  885.  
  886.  
  887. OSErr Send_GXPostScriptDoPageSetup (gxFormat, long, gxPostScriptImageDataHdl)
  888.     = GXPOSTSCRIPTMSGGLUE(gxPostscriptDoPageSetUp);
  889. OSErr Forward_GXPostScriptDoPageSetup (gxFormat, long, gxPostScriptImageDataHdl)
  890.     = GXFORWARDGLUE;
  891.  
  892. OSErr Send_GXPostScriptSelectPaperType (gxPaperType, long, gxPostScriptImageDataHdl)
  893.     = GXPOSTSCRIPTMSGGLUE(gxPostscriptSelectPaperType);
  894. OSErr Forward_GXPostScriptSelectPaperType (gxPaperType, long, gxPostScriptImageDataHdl)
  895.     = GXFORWARDGLUE;
  896.  
  897. OSErr Send_GXPostScriptDoPageTrailer (GXPostScriptImageDataHdl)
  898.     = GXPOSTSCRIPTMSGGLUE(gxPostscriptDoPageTrailer);
  899. OSErr Forward_GXPostScriptDoPageTrailer (GXPostScriptImageDataHdl)
  900.     = GXFORWARDGLUE;
  901.  
  902. OSErr Send_GXPostScriptEjectPage (gxPaperType, long pagenumber, long copiescount, short erasepage, gxPostScriptImageDataHdl)
  903.     = GXPOSTSCRIPTMSGGLUE(gxPostscriptEjectPage);
  904. OSErr Forward_GXPostScriptEjectPage (gxPaperType, long pagenumber, long copiescount, short erasepage, gxPostScriptImageDataHdl)
  905.     = GXFORWARDGLUE;
  906.  
  907.  
  908. // shape imaging messages
  909.  
  910.  
  911. OSErr Send_GXPostScriptProcessShape (gxShape page,long trcount, gxTransform trlist[])
  912.     = GXPOSTSCRIPTMSGGLUE(gxPostscriptProcessShape);
  913. OSErr Forward_GXPostScriptProcessShape (gxShape page,long trcount, gxTransform trlist[])
  914.     = GXFORWARDGLUE;
  915.  
  916.  
  917. #ifdef __cplusplus
  918. }
  919. #endif
  920.  
  921.  
  922.  
  923. /* ------------------------------------------------------------------------------
  924.  
  925.                                             Driver API Functions
  926.  
  927. -------------------------------------------------------------------------------- */
  928.  
  929.  
  930. #define GXDRIVERAPIGLUE(selector) {0x203C, 0x0002, selector, 0xABFE}
  931.  
  932.  
  933. #ifdef __cplusplus
  934. extern "C" {
  935. #endif
  936.  
  937.  
  938. OSErr GXAddPrinterViewDevice (gxPrinter, gxViewDevice)
  939.     = GXDRIVERAPIGLUE(0);
  940.  
  941. OSErr GXGetAvailableJobFormatModes (gxJobFormatModeTableHdl *)
  942.     = GXDRIVERAPIGLUE(1);
  943.  
  944. OSErr GXSetPreferredJobFormatMode (gxJobFormatMode, Boolean directOnly)
  945.     = GXDRIVERAPIGLUE(2);
  946.  
  947. OSErr GXCoolAlert (short iconId,
  948.                       short txtSize,
  949.                       short defaultTitleNum,
  950.                       short cancelTitleNum,
  951.                       short textLength,
  952.                       Ptr pAlertMsg,
  953.                       StringPtr actionTitle,
  954.                       StringPtr title2,
  955.                       StringPtr title3,
  956.                       StringPtr msgFont,
  957.                       ModalFilterProcPtr filterProc,
  958.                       short *itemHit,
  959.                       StringPtr    alertTitle)
  960.     = GXDRIVERAPIGLUE(3);
  961.  
  962. OSErr GXGetCoolAlert (short coolResId, ModalFilterProcPtr, short *itemHit) 
  963.     = GXDRIVERAPIGLUE(4);
  964.  
  965.  
  966. OSErr GXFetchDTPData (Str31 dtpName, ResType theType, short theID, Handle *theData)
  967.     = GXDRIVERAPIGLUE(5);
  968.  
  969. OSErr GXWriteDTPData (Str31 dtpName, ResType theType, short theID, Handle theData)
  970.     = GXDRIVERAPIGLUE(6);
  971.  
  972. OSErr GXHandleChooserMessage (gxJob *aJob, Str31 driverName, short message, short caller, 
  973.                                      StringPtr objName, StringPtr zoneName, ListHandle theList, long p2)
  974.     = GXDRIVERAPIGLUE(7);
  975.  
  976.  
  977. #ifdef __cplusplus
  978. }
  979. #endif
  980.  
  981.  
  982. #endif __PRINTINGDRIVERS__